/*
 * 娱乐城	核心JS文件
 * Author	1041865683@qq.com
 * Date		2017-04-09
 */


/*
 * 余额刷新
 */
$('.money .refresh').click(function(){
	$.xpost(xn.url('game-api-jsks-coin'), function(code, message){
		$('#money').text(message);
	});
});


/*
 * 自适应
 */
// 右侧内容栏
$('.rightconent').width(Math.floor($(document.body).width()-$('.sider').width()-50));
$('.rightconent').height(Math.floor($(document.body).height()-$('.header').height()-20));
// 左侧侧边栏
$('.sider').height(Math.floor($(document.body).height()-$('.header').height()));


/* 左侧侧边栏加号 */
$('.leftLotterys .menu_head').click(function(){
	var $this = $(this).find('.plus');
	$this.parent().parent().next().find('a').slideToggle();
	$this.toggleClass('d');
	if(/d/.test($this.attr('class'))){
		$this.text('-');
		$this.addClass('d');
	}else{
		$this.text('+');
		$this.removeClass('d');
	}
});


/* 隐藏/显示侧边栏 */
var sideShow = 1;
$('.headmenu').click(function(){
	if(sideShow==1){
		sideShow = 0;
		$('.headmenu').css('background-position','0 -26px');
		$('.sider').animate({marginLeft:'-250px'}, 300);
		$('.logoBox').animate({marginLeft:'-165px'}, 300, function(){
			$('.rightconent').css('marginRight','125px');
		});
	}else{
		sideShow = 1;
		$('.headmenu').css('background-position','0 0');
		$('.sider').animate({marginLeft:'0'}, 300);
		$('.logoBox').animate({marginLeft:'0'}, 300, function(){
			$('.rightconent').css('marginRight','0');
		});
	}
});


